package com.zbkj.admin.task.user;

import cn.hutool.core.date.DateUtil;
import com.zbkj.service.service.PaidMemberOrderService;
import com.zbkj.service.service.PaidMemberService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 用户会员卡赠送余额定时任务
 */
@Component("PaidMemberCardGiftBalanceTask")
public class PaidMemberCardGiftBalanceTask {

    private static final Logger logger = LoggerFactory.getLogger(PaidMemberCardGiftBalanceTask.class);

    @Autowired
    private PaidMemberOrderService paidMemberOrderService;

    /**
     * 每天凌晨12点执行一次
     */
    public void processing() {
        logger.info("---PaidMemberCardGiftBalanceTask Processing------produce Data with fixed rate task: Execution Time - {}", DateUtil.date());
        try {
            paidMemberOrderService.giftBalanceTask();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("PaidMemberCardGiftBalanceTask.Processing" + " | msg : " + e.getMessage());
        }
    }

}
